package com.example.demo.vo

import com.example.demo.dao.TDoctorDao
import com.example.demo.dao.TNurseDao
import com.example.demo.dbmodels.TNurse
import me.liuwj.ktorm.dsl.QueryRowSet
import java.math.BigDecimal
import java.time.LocalDateTime

class NurseVo {

    /**
     *  护士ID
     **/
    var id: Int ? = null
    /**
     *  工号
     **/
    var code: String? = null
    /**
     *  病区编码
     **/
    var district_code: String? = null
    /**
     *  科室编码
     **/
    var dept_code: String? = null
    /**
     *  用户ID
     **/
    var user_id: Int?= null
    /**
     *  护士姓名
     **/
    var name: String? = null
    /**
     *  性别（1-男、0-女、2-未知）
     **/
    var sex: Int?= null
    /**
     *  婚姻情况(0-未婚、1-已婚、2-未知)
     **/
    var marriage: Int?= null
    /**
     *  出生日期
     **/
    var birthday: LocalDateTime? = null
    /**
     *  行政区代码
     **/
    var pca_code: Int? = null
    /**
     *  地址
     **/
    var address: String? = null
    /**
     *  邮政编码
     **/
    var post_code: String? = null
    /**
     *  手机号码
     **/
    var mobile: String?= null
    /**
     *  简介
     **/
    var intro: String? = null
    /**
     *  特长
     **/
    var specialty: String? = null
    /**
     *  区域编码
     **/
    var area_code: String? = null
    /**
     *  学历
     **/
    var education: String? = null
    /**
     *  职称
     **/
    var title: String? = null
    /**
     *  社会机构及职务
     **/
    var duties: String? = null
    /**
     *  证件类型
     **/
    var id_type: Int? = null
    /**
     *  证件号码
     **/
    var id_number: String? = null
    /**
     *  证件图片
     **/
    var id_url: String?=  null
    /**
     *  护士头像图片
     **/
    var image_url: String? =null
    /**
     *  身高
     **/
    var height: BigDecimal?= null
    /**
     *  体重
     **/
    var weight: BigDecimal?= null
    /**
     *  排序
     **/
    var sort: Int?= null
    /**
     *  状态1=有效，0=无效
     **/
    var status: Int?= null
    /**
     *  备注
     **/
    var remark: String?= null
    /**
     *  更新时间
     **/
    var update_time: LocalDateTime? = null
    /**
     *  更新人
     **/
    var update_by: Int? = null
    /**
     *  删除标记
     **/
    var is_del: Boolean? = null


    fun getDoctorVo(queue: QueryRowSet): NurseVo {
        queue.let {
            val data = NurseVo()
            data.address = it[TNurseDao.address]
            data.area_code =it[TNurseDao.area_code]
//            data.birthday = it[TNurseDao.address]
            data.code =it[TNurseDao.code]
            data.dept_code = it[TNurseDao.dept_code]
            data.district_code = it[TNurseDao.district_code]
            data.duties = it[TNurseDao.duties]
            data.education =it[TNurseDao.education]
            data.height =it[TNurseDao.height]
            data.id = it[TNurseDao.id]
            data.id_number = it[TNurseDao.id_number]
            data.id_type =it[TNurseDao.id_type]
            data.id_url =it[TNurseDao.id_url]
            data.image_url = it[TNurseDao.image_url]
            data.intro =it[TNurseDao.intro]
            data.is_del = it[TNurseDao.is_del]
            data.marriage =it[TNurseDao.marriage]
            data.mobile =it[TNurseDao.mobile]
            data.name =it[TNurseDao.name]
            data.pca_code =it[TNurseDao.pca_code]
            return  data
        }

    }



        fun getNurseVo(table: TNurse):NurseVo{
        table.let {
            val data = NurseVo()
            data.address = it.address
            data.area_code = it.area_code
            data.birthday = it.birthday
            data.code = it.code
            data.dept_code = it.dept_code
            data.district_code = it.district_code
            data.duties = it.duties
            data.education = it.education
            data.height = it.height
            data.id = it.id
            data.id_number = it.id_number
            data.id_type = it.id_type
            data.id_url = it.id_url
            data.image_url = it.image_url
            data.intro = it.intro
            data.is_del = it.is_del
            data.marriage = it.marriage
            data.mobile = it.mobile
            data.name = it.name
            data.pca_code = it.pca_code
            return  data
        }
    }


    fun getNurseVoList(table: List<TNurse>? ):List<NurseVo>?{
        table?.let{
            val nurseVoList= mutableListOf<NurseVo>()
            table.forEach {
                val data = NurseVo()
                data.address = it.address
                data.area_code = it.area_code
                data.birthday = it.birthday
                data.code = it.code
                data.dept_code = it.dept_code
                data.district_code = it.district_code
                data.duties = it.duties
                data.education = it.education
                data.height = it.height
                data.id = it.id
                data.id_number = it.id_number
                data.id_type = it.id_type
                data.id_url = it.id_url
                data.image_url = it.image_url
                data.intro = it.intro
                data.is_del = it.is_del
                data.marriage = it.marriage
                data.mobile = it.mobile
                data.name = it.name
                data.pca_code = it.pca_code
                nurseVoList.add(data)
            }
            return  nurseVoList
        }
        return null
    }


}